#include<iostream>
using namespace std;

int main()
{
    int fl=0;
    string s="";
    string str;
    cout<<"Введение строчку:"<< endl;
    cin>>str;
    
    for (int i=0; i<str.size(); i++)
        {
            if(str[i]=='(' or str[i]=='{' or str[i]=='[' or str[i]=='<')
            {
                s+=str[i];
            }
            if(str[i]==')' or str[i]=='}' or str[i]==']' or str [i]=='>')
            {
                if(s[s.size()-1]=='(')
                {
                    s.pop_back();
                }
                else
                {
                    fl=1;
                    break;
                }
            }
        }
    if (fl==0 and s.size()==0)
    {
        cout<<"True";
    }
    else
    {
        cout<<"False";
    }
    
    return 0;
}
